package com.rxkj.fxx.face;

import android.app.Activity;
import android.app.Application;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;

import com.fxx.face.http.utils.LoggerUtil;

import okhttp3.OkHttpClient;

/**
 * MyApplication
 */
public class MyApplication extends Application {

    private static Map<String, Activity> destroyMap = new HashMap<>();

    /**
     * 添加到销毁队列
     * @param activity 要销毁的activity
     */
    public static void addDestroyActivity(Activity activity, String activityName) {
        destroyMap.put(activityName, activity);
    }

    /**
     * 销毁指定Activity
     */
    public static void destroyActivity(String activityName) {
        Set<String> keySet = destroyMap.keySet();
        for (String key : keySet) {
            destroyMap.get(key).finish();
        }
    }

    @Override
    public void onCreate() {
        super.onCreate();
        //初始化logger打印
        LoggerUtil.initLogger();
    }
}
